﻿using System;
using System.Collections.Generic;
using System.Text;

namespace 第三次课堂作业
{
    class Square : Shape
    {
        private double length;

        public Square(double length)
        {
            this.length = length;
            if (isLegal())
                Console.WriteLine("This is a Square. The area is " + Area);
            else
            {
                Console.WriteLine("The input is not legal. Make another Instance.");
            }
        }

        public override double Area
        {
            get
            {
                return length * length;
            }
        }

        public override bool isLegal()
        {
            if (length <= 0)
                return false;
            return true;
        }
    }
}
